/**
 * 
 */
package com.shequan.shequan.service.impl;

import java.util.List;

import com.shequan.common.bean.ResultDataStruct;
import com.shequan.common.bean.ViewTextConstans;
import com.shequan.shequan.bean.pojo.ShequanType;
import com.shequan.shequan.dao.ShequanTypeDAO;
import com.shequan.shequan.service.ShequanTypeService;

/**
 * <P>
 * Copyright 2012.
 * </p>
 * <P>
 * All Rights Reserved.
 * </p>
 * @author YuJF
 * @version 1.0, 2012-3-8
 * @see com.shequan.shequan.service.impl.ShequanTypeServiceImpl 
 * @since 1.0
 */
public class ShequanTypeServiceImpl implements ShequanTypeService {
	private ShequanTypeDAO shequanTypeDAO;

	public void setShequanTypeDAO(ShequanTypeDAO shequanTypeDAO) {
		this.shequanTypeDAO = shequanTypeDAO;
	}

	/* (non-Javadoc)
	 * @see com.shequan.shequan.service.ShequanTypeService#queryAllShequanType()
	 */
	public ResultDataStruct<List<ShequanType>> queryAllShequanType() {
		ResultDataStruct<List<ShequanType>> rds=new ResultDataStruct<List<ShequanType>>();
		try {
			List<ShequanType> shequanTypes=shequanTypeDAO.selectAll();
			if(shequanTypes==null||shequanTypes.size()==0){
				rds.setMessage(ViewTextConstans.SHEQUAN_INFO_IS_EMPTY_MESSAGE);
				rds.setBusiSuccess(false);
			}else{
				rds.setBusiSuccess(true);
				rds.setData(shequanTypes);
			}
			rds.setSuccess(true);
		} catch (Exception e) {
			e.printStackTrace();
			rds.setSuccess(false);
			rds.setMessage(ViewTextConstans.UNKNOW_ERROR_MSG);
		}
		return rds;
	}

}
